/*
 * $Id: api.h 50 2009-02-10 05:48:05Z hyunghwan.chung $
 *
   Copyright 2005-2009 Chung, Hyung-Hwan.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an  BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */

#ifndef _XP_SYS_API_H_
#define _XP_SYS_API_H_

#include <xp/types.h>
#include <xp/macros.h>
#include <xp/bas/time.h>

typedef struct xp_meminfo_t xp_meminfo_t;

struct xp_meminfo_t
{
        xp_ulong_t totalram;
        xp_ulong_t availram;
        xp_ulong_t freeram;
        xp_ulong_t totalswap;
        xp_ulong_t availswap;
        xp_ulong_t freeswap;
};

enum
{
	XP_HALT_POWEROFF,
	XP_HALT_RESTART,
	XP_HALT_SHUTDOWN
};

enum
{
	XP_HALT_FORCE = (1 << 0),
	XP_HALT_TIMED = (1 << 1)
};

#ifdef __cplusplus
extern "C" {
#endif

/*
 * int xp_halt (int cmd, int opt);
 *
 * [opt & XP_HALT_TIMED]
 * int xp_halt (int cmd, int opt, xp_time_t tmout, const xp_char_t* msg); 
 */
int xp_halt (int cmd, int opt, ...);

int xp_getncpus (xp_size_t* ncpus);
int xp_getmeminfo (xp_meminfo_t* meminfo);
int xp_getuptime (xp_time_t* uptime);

#ifdef __cplusplus
}
#endif

#endif
